-
Notifications
You must be signed in to change notification settings - Fork 14.9k
release/21.x: [CMake][AIX] quote the string AIX if
conditions
#156505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/21.x
Are you sure you want to change the base?
Conversation
A CMake change included in CMake 4.0 makes `AIX` into a variable (similar to `APPLE`, etc.) https://gitlab.kitware.com/cmake/cmake/-/commit/ff03db6657c38c8cf992877ea66174c33d0bcb0b However, `${CMAKE_SYSTEM_NAME}` unfortunately also expands exactly to `AIX` and `if` auto-expands variable names in CMake. That means you get a double expansion if you write: `if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")` which becomes: `if (AIX MATCHES "AIX")` which is as if you wrote: `if (ON MATCHES "AIX")` You can prevent this by quoting the expansion of "${CMAKE_SYSTEM_NAME}", due to policy [CMP0054](https://cmake.org/cmake/help/latest/policy/CMP0054.html#policy:CMP0054) which is on by default in 4.0+. Most of the LLVM CMake already does this, but this PR fixes the remaining cases where we do not. (cherry picked from commit 63195d3)
This is a follow on to llvm#154537, which quoted the CMAKE_SYSTEM_NAME to avoid expanding it again when that CMAKE_SYSTEM_NAME expands to AIX. But by the same logic, we also need to quote the plain string AIX as well. (cherry picked from commit 3e6ec47)
@hubert-reinterpretcast What do you think about merging this PR to the release branch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Uhm - this looks pretty big and seems like something that can easily break certain build configurations since it doesn't seem to touch only AIX. Is this in main without any issues? Does it really NEED to be merged for the release branch at this point? |
Agreed that this looks big and scary, but it's a purely mechanical change, that is a no-op for most targets. I'll add a long form rational at the end of the comment about why I don't think the patch effects anyone but AIX to keep my answers brief.
Yes, these patches have been in main for several weeks at this point with no reported issues.
It would help us out for the point releases. Without this patch, we're unable to build on AIX with CMake from our package manager (4.0). We can manually downgrade if we're unwilling to merge this, but it's a bit of a pain. Rationale about why the patch doesn't affect targets besides AIX We quote the string AIX and variable expansions which might expand to string AIX (i.e. This has an effect only if Intersecting the two list gives me the following list of affect targets:
Of those targets, only CYGWIN appears in the lines affected by the patch, and it's already using a variable check (i.e. it checks |
Hi @tru! Any thoughts regarding @daltenty's response on this backport? |
I still feel pretty sketchy about this one. It seems large and could affect other platforms than AIX since it's changing the build system in pretty large ways. I would be much more comfortable if we just drop this for the release branch and make sure it's working well in I understand it could be a bit of a pain for the AIX packages - but I wonder if it's not worth a little pain for a platform that ... frankly isn't that mainstream in order to avoid any potential issues with other platforms. I understand that it's not a blocker really, just annoying so that gives me more confidence to reject this. |
Backport 63195d3 3e6ec47
Requested by: @amy-kwan